package com.woniu.coupon.controller.web;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.woniu.coupon.domain.Coupon;
import com.woniu.coupon.service.ICouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 优惠券Controller
 *
 * @author yy
 * @date 2023-04-03
 */
@RestController("CouponWebControllerTwo")
@RequestMapping("/coupon/tbcoupon/web")
public class CouponWebController extends BaseController
{
    @Autowired
    private ICouponService couponService;

    /**
     * 修改优惠券
     */
    //@PreAuthorize("@ss.hasPermi('coupon:tbcoupon:edit')")


    @PostMapping("getNewCoupon")
    public AjaxResult edit(Long couponId, HttpServletRequest request)
    {
//        String customerId = request.getHeader("customerId");
        String customerId = request.getHeader("userId");
        couponService.getNewCoupon(couponId,Long.valueOf(customerId));
        return AjaxResult.success();
    }
}
